package data.utils;

import data.Gene;

public class Manhattan implements GeneDistanceCalculator {

	@Override
	public double distance(Gene g1, Gene g2) {
		int max = Math.min(g1.getVeriables().length, g2.getVeriables().length);
		double sum =0;
		for (int i=0; i<max; i++) {
			sum += Math.abs(g1.getVeriables()[i]-g2.getVeriables()[i]);
		}
		return sum;
	}

}
